Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution? #778

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Solution? #778

wants to merge 3 commits into from

Conversation

dxrrkwm
Copy link

@dxrrkwm dxrrkwm commented Oct 4, 2024

No description provided.

app/knights.py Outdated
Comment on lines 15 to 16
for armor in self.armour:
self.protection += armor["protection"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use list and list comprehension for that?

@dxrrkwm dxrrkwm requested a review from Nattalli October 9, 2024 13:28
Copy link

@AnyoneClown AnyoneClown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, check comment

app/knights.py Outdated
Comment on lines 14 to 15
def apply_armor(self) -> None:
for armor in self.armour:
self.protection += armor["protection"]
self.protection = sum([armor["protection"] for armor in self.armour])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use simple generator for this. Even without list

self.protection = sum(armor["protection"] for armor in self.armour)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense🫠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants